/**
 * 
 */
package com.daily.expenses;

import com.daily.expenses.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

/**
 * @author No3x source:
 *         http://www.androidhive.info/2011/12/android-dashboard-design
 *         -tutorial/
 */
public class Dashboard extends Activity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.dashboard);

                /**
                 * Creating all buttons instances
                 * */
                // Dashboard Records button
                Button btn_records = (Button) findViewById(R.id.dashboard_btn_records);

                // Dashboard Stats button
                Button btn_stats = (Button) findViewById(R.id.dashboard_btn_stats);

                // Dashboard Reserved button
                Button btn_reserved = (Button) findViewById(R.id.dashboard_btn_reserved);

                /**
                 * Handling all button click events
                 * */

                // Listening to News Feed button click
                btn_records.setOnClickListener(new View.OnClickListener() {

                        @Override
                        public void onClick(View view) {
                                // Launching News Feed Screen
                                Intent i = new Intent(getApplicationContext(), RecordsOverviewActivity.class);
                                startActivity(i);
                        }
                });

                // Listening Friends button click
                btn_stats.setOnClickListener(new View.OnClickListener() {

                        @Override
                        public void onClick(View view) {
                                // Launching News Feed Screen
                                Intent i = new Intent(getApplicationContext(), TabStats.class);
                                startActivity(i);
                        }
                });

                // Listening Messages button click
                btn_reserved.setOnClickListener(new View.OnClickListener() {

                        @Override
                        public void onClick(View view) {
                                // Launching News Feed Screen
                                Intent i = new Intent(getApplicationContext(), TabReserved.class);
                                startActivity(i);
                        }
                });

        }

        /* Menu */
        @Override
        public boolean onCreateOptionsMenu(android.view.Menu menu) {
                getMenuInflater().inflate(R.menu.menu, menu);
                Toast.makeText(this, "MENU", Toast.LENGTH_SHORT);
                return super.onCreateOptionsMenu(menu);
        }

        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
                switch (item.getItemId()) {
                case R.id.opt_help:
                        Toast.makeText(this, "Help Menu", Toast.LENGTH_SHORT);
                        return true;

                case R.id.opt_back:
                        Toast.makeText(this, "Back", Toast.LENGTH_SHORT);
                        finish();

                case R.id.opt_exit:
                        super.finish();
                }
                return super.onOptionsItemSelected(item);
        }

}
